<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>数字排序器</title>
    <style>
        body {
            font-family: 'Microsoft Yahei', sans-serif;
            max-width: 600px;
            margin: 50px auto;
            padding: 20px;
            background-color: #f0f2f5;
        }

        .container {
            background: white;
            padding: 30px;
            border-radius: 10px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        }

        .input-group {
            margin: 15px 0;
        }

        input[type="number"] {
            width: 200px;
            padding: 10px;
            border: 2px solid #ddd;
            border-radius: 5px;
            font-size: 16px;
            transition: border-color 0.3s;
        }

        input[type="number"]:focus {
            border-color: #409eff;
            outline: none;
        }

        button {
            background-color: #409eff;
            color: white;
            padding: 12px 25px;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            font-size: 16px;
            transition: background-color 0.3s;
            margin-top: 15px;
        }

        button:hover {
            background-color: #66b1ff;
        }

        #result {
            margin-top: 25px;
            padding: 15px;
            border-radius: 5px;
            font-size: 18px;
        }

        .error {
            color: #f56c6c;
            margin-top: 15px;
            font-weight: bold;
        }

        .success {
            color: #67c23a;
            background-color: #f0f9eb;
            border: 1px solid #e1f3d8;
        }
    </style>
</head>
<body>
    <div class="container">
        <h2>数字排序器</h2>
        
        <div class="input-group">
            <input type="number" id="num1" placeholder="输入第一个数字">
        </div>
        
        <div class="input-group">
            <input type="number" id="num2" placeholder="输入第二个数字">
        </div>
        
        <div class="input-group">
            <input type="number" id="num3" placeholder="输入第三个数字">
        </div>

        <button onclick="sortNumbers()">排序</button>

        <div id="result"></div>
        <div id="error" class="error"></div>
    </div>

    <script>
        function sortNumbers() {
            // 获取输入值
            const num1 = parseFloat(document.getElementById('num1').value);
            const num2 = parseFloat(document.getElementById('num2').value);
            const num3 = parseFloat(document.getElementById('num3').value);
            
            // 清空之前的提示
            document.getElementById('error').textContent = '';
            document.getElementById('result').textContent = '';
            document.getElementById('result').className = '';

            // 验证输入
            if (isNaN(num1) || isNaN(num2) || isNaN(num3)) {
                document.getElementById('error').textContent = '⚠ 请输入有效的数字！';
                return;
            }

            // 创建数组并排序
            const numbers = [num1, num2, num3];
            numbers.sort((a, b) => a - b);  // 升序排序

            // 显示结果
            const resultDiv = document.getElementById('result');
            resultDiv.textContent = `排序结果：${numbers.join(' → ')}`;
            resultDiv.className = 'success';
        }
    </script>
</body>
</html>